<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增调货')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-DeptProductCargo-add">
            <input id="deptSource" name="deptSource"  type="hidden" th:value="${webDeptProductCargo.deptSource}"/>
            <input id="deptId" name="targetSource"  type="hidden"/>
            <input id="productId" name="productId" th:value="${webDeptProductCargo.productId}" type="hidden"/>
            <input id="productName" name="productName" th:value="${webDeptProductCargo.productName}" type="hidden"/>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">调货商品：</label>
                <div class="col-sm-8 form-control-static" th:text="${webDeptProductCargo.productName}">
                    <input name="deptSource" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">调货发起门店：</label>
                <div class="col-sm-8 form-control-static" th:text="${webDeptProductCargo.deptSourceName}">
                    <input name="deptSource" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">调货目标门店：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" name="deptName" onclick="selectDeptTree()" id="treeName" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">申请数量：</label>
                <div class="col-sm-8">
                    <input class="form-control number" type="text" name="number" required>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label is-required">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cargo_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>-->

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/DeptProductCargo"
        $("#form-DeptProductCargo-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-DeptProductCargo-add').serialize());
            }
        }

        /* 用户管理-修改-选择部门树 */
        function selectDeptTree() {
        	var deptId = $.common.isEmpty($("#deptId").val()) ? "100" : $("#deptId").val();
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
		    var options = {
				title: '选择部门',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}


        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var deptId = body.find('#treeId').val();
            $("#deptId").val(deptId);
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    </script>
</body>
</html>